package com.twu.biblioteca;

public class ShowAllMoviesAction implements Action {
    private Library library;

    public ShowAllMoviesAction(Library library) {
        this.library = library;
    }

    public String execute() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("\nThe movie list is as follow:\n");

        for (Movie movie : library.getMovies()) {
            stringBuffer.append(movie.toString() + "\n");
        }
        return stringBuffer.toString();
    }
}
